/**
 * 
 */
package com.etlmaster.executor.steps.func;


import com.etlmaster.executor.StepMeta;
import com.etlmaster.executor.annotation.StepInstruction;
import com.etlmaster.executor.utils.StepState;

/**
 * 休眠
 * @author MeiKefu
 * @date 2015-1-8
 */
@StepInstruction("sleep")
public class SleepStep extends FuncStep{
	
	private SleepStepMeta meta;
	
	
	public SleepStep(StepMeta meta) {
		super(meta);
		this.meta=(SleepStepMeta)meta;
	}

	@Override
	protected int handle() {
		try{
			int sec =10;
			if(meta.getSecond()!=null){
				sec = meta.getSecond();
			}
			meta.log("INFO","休眠{}秒",sec+"");
			Thread.sleep(sec*1000);
		}catch(Exception e){
			meta.log("ERROR","线程休眠报错{}",e.getMessage());
		}
		return StepState.RUNNING_SUCCESSED;
	}

	@Override
	public boolean stop() {
		return false;
	}
	
	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
	}
}
